updating oE print

print

<built-in> procedure print(integer fn, object x) 

displays an object using numbers and braces.

Comments:

All data objects are in binary format within computer hardware; something that is easy to forget. An output routine must convert these binary values into "text" to be human readable. The procedures print and ? produce a "text" representation of an object that is output to a file or device. The text shows the numerical form of the object. If the object x is a sequence it uses braces { , , , } to show the structure.

Parameters:
  1. fn : an integer, the handle to a file or device to output to
  2. x : the object to print
Errors:

The target file or device must be open and able to be written to.

Comments:

This is not used to write to "binary" files as it only outputs text.

Example 1:
include std/io.e 
print(STDOUT, "ABC")   -- output is:  "{65,66,67}" 
puts (STDOUT, "ABC")    -- output is:  "ABC" 
print(STDOUT, "65")    -- output is:  "65" 
puts (STDOUT, 65)       -- output is:  "A"  (ASCII-65 ==> 'A') 
print(STDOUT, 65.1234) -- output is:  "65.1234" 
puts (STDOUT, 65.1234)  -- output is:  "A" (Converts to integer first) 
Example 2:
include std/io.e 
print(STDOUT, repeat({10,20}, 3)) -- output is: {{10,20},{10,20},{10,20}} 
See Also:

?, puts

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu